The QuickDraw 3D Viewer Controller on Win32
	41.1	Introduction 
This chapter describes the QuickDraw 3D Viewer Controller (or 3D Viewer), which provides a high-level interface for displaying 3D objects and other data in a window and allowing users limited interaction with those objects. You can use the functions described here to present 3D data (stored either in a file or in memory) to users quickly and easily. The 3D Viewer provides controls with which the user can manipulate several aspects of the displayed data, such as the point of view.
IMPORTANT
The 3D Viewer allows you to display 3D data in 3DMF metafiles (or in memory) with minimal programming effort. It is analogous to the movie controller provided with QuickTime, which allows you, also with minimal programming effort, to display and allow users to control movies. If your application needs more advanced rendering or interaction capabilities, or if you want to allow users to create and manipulate objects dynamically, you can use the lower-level QuickDraw 3D application programming interfaces in addition to, or instead of, the higher-level 3D Viewer programming interfaces.
The 3D Viewer supports the same platforms as the QuickDraw 3D library. Two versions of the 3D Viewer library are available: one to support the PowerPC version of the MacOS and the other to support the Win32 API  running on either Windows 95 or  the Intel processor version of Windows NT 3.51 and later. The two different versions of the viewer have similar APIs and can be used similarly. But the two different versions of the 3D Viewer are intimately tied to the target platform through dependencies on each platform’s base graphics libraries, their window management systems and their respective event handling architectures. Therefore, the APIs are not identical, there are some API functions and constant which are unique to one platform or the other and many of the functions take different parameters. Because of these necessary differences the two libraries have different symbolic namespaces. The MacOS version of the 3D Viewer uses the original Q3Viewer... naming for compatibility reasons, for example: Q3ViewerNew. The Win32 version of the 3D Viewer uses a Q3WinViewer... naming convention, for example: Q3WinViewerNew. 
	41.2	About the 3D Viewer
The 3D Viewer (or, more briefly, the Viewer) is a shared library that provides a very simple method for displaying 3D models, together with a set of controls that permit limited interaction with those models. 
An instance of the 3D Viewer is a viewer object. Every viewer object is typically associated with exactly one window, within which the viewer object must be entirely contained. The viewer object can occupy the entire content region of the window, or it can occupy some smaller portion of the window. Your application can create more than one viewer object; indeed, it can create more than one viewer object associated with a single window.
When a viewer object is first created and displayed to the user, it consists of a picture area that contains the displayed image and either a controller strip or a badge. The controller strip is a rectangular area at the bottom of the viewer object that contains one or more controls. (See the following section for a complete explanation of these controls.) A badge is a visual element that is displayed in the picture area when the controller strip is not visible. The user can click on the badge to make the controller strip appear.
It’s important to understand that the 3D Viewer is built on top of QuickDraw 3D, but you don’t need to call any QuickDraw 3D functions to use the 3D Viewer. The 3D Viewer is a DLL  that is separate from the QuickDraw 3D shared library. You can call Q3WinViewerNew (and any other 3D Viewer functions) without having called Q3Initialize to initialize QuickDraw 3D. The models displayed by the Viewer must be structured according to the QuickDraw 3D Metafile specification, but the metafile data can be stored either in a file or in memory.
	41.2.1	Controller Strips
The 3D Viewer provides control elements for manipulating the location and orientation of the user’s point of view (that is, of the view’s camera). 
These controls are, from left to right:
•	The camera viewpoint popup. This control allows the user to view the model from a different camera viewpoint. Holding down the camera viewpoint button causes a pop-up menu to appear, listing the pre-defined direction cameras as well as any perspective (view angle aspect) cameras stored in the view hints of the 3DMF data. If any such cameras in the data have name attributes associated with them the names will be displayed in the popup. Otherwise the cameras will be listed as “Camera #1” etc. (The pre-defined direction cameras are calculated based on the front and top custom attributes if present in the 3DMF view hints. Otherwise the pre-defined camera directions are calculated from the model’s coordinate space.) Whether this popup is displayed is controlled through the kQ3ViewerButtonCamera flag. 
Note: only cameras of the type kQ3CameraTypeViewAngleAspect are displayed in the camera viewpoint popup menu.
•	The distance button. This control allows the user to move closer to or farther away from the model. Clicking the distance button and then dragging the cursor downward in the picture area causes the displayed object to move closer. Dragging the cursor upward in the picture area causes the displayed object to move farther away. The up and down arrow keys cause the model to move farther or closer respectively. This modal state button is controlled through the kQ3ViewerButtonTruck flag. 
•	The rotate button. This control allows the user to effectively rotate an object. Clicking the rotate button and then dragging the cursor in the picture area causes the displayed object to rotate in the direction in which the cursor is dragged. The left and right arrow keys cause the model to rotate left and right. The up and down arrow keys cause the model to rotate up and down. This modal state button is controlled through the kQ3ViewerButtonOrbit flag. 
•	The zoom button. This control allows the user to alter the field of view of the current camera, thereby zooming in or out on the object in the model. The up and down arrow keys cause the model to zoom out and in.  This button is not displayed by default. This modal state button is controlled through the kQ3ViewerButtonZoom flag.
•	The move button. This control allows the user to move an object. Clicking the move button and then dragging on the object in the picture area causes the object to be moved to a new location. The up, down, left and right arrow keys cause the model to move up, down, left or right respectively. This modal state button is controlled through the kQ3ViewerButtonDolly flag.
•	The reset button. This push-button resets the camera viewpoint to its initial setting. Whether this push-button is displayed is controlled through the kQ3ViewerButtonReset flag.
Your application controls which of these buttons are displayed in a viewer object’s controller strip at the time you create the viewer object, or by appropriately setting a viewer’s flags. 
	41.2.2	Badges
The 3D Viewer allows your application to distinguish 3D data from static graphics in documents by the use of a badge. 
The badge lets the user know that the image represents a 3D model rather than a static image. A badge appears when the viewer object is first displayed and the kQ3ViewerShowBadge flag is set in the object’s viewer flags. When the user clicks the badge, the badge disappears and the standard controller strip appears.
Note: The badge control is one-directional. It only switches a viewer from badge mode to controller strip mode. There is no user interface control to switch the viewer back to badge mode.  It is the responsibility of the host application to redisplay the badge by resetting the viewer’s badge flag and clearing the control strip flag. For example, when a viewer object is deselected in a compound document the application may switch the viewer back to badge mode. 
Your application can control whether the 3D Viewer displays a badge in a viewer pane by appropriately setting a viewer’s flags. See “Viewer Flags” for more information.
Typically you won’t want your viewer to support interaction when the badge is displayed. To disable interaction you must set the viewer’s kQ3ViewerButtonNone flag.
	41.2.3			Drag and Drop
The version 1.5.0  release of the 3D Viewer for Win32 only supports dropping 3DMF files onto the viewer window via the WM_DROPFILES mechanism. A Win32 application wanting to support full drag and drop with the 3D Viewer will need to use an external protocol such as the OLE data transfer interfaces.
A host application can also set the viewer to a special mode where the only interaction supported is dropping files. This mode must be explicitly set with the kQ3ViewerButtonNone flag.
Note: kQ3ViewerButtonNone is similar to the kQ3ViewerDragMode of the MacOS version of the 3D Viewer.
An application can receive notifications when the 3D Viewer handles WM_DROPFILES via WM_NOTIFY messages. This way an application can update its title bar with the name of the currently displayed 3DMF for example.
	41.3	Using the 3D Viewer with Win32
This section provides examples of how to use the Win32 version of the QuickDraw 3D Viewer  Controller to display 3D data in a window.
	41.3.3	Creating a Viewer 
You can create a viewer object by calling the Q3WinViewerNew function. You pass Q3WinViewerNew a handle to the parent window typically in which you want the viewer to appear, the rectangle that is to contain the viewer pane, and a selector indicating which viewer features to enable. Q3WinViewerNew returns a reference to a viewer object. The function MyCreateViewer below creates a viewer that occupies the entire client rectangle of the parent window which is passed to it as a parameter.

TQ3ViewerObject MyCreateViewer (HWND hWnd)
{
	RECT aWinRect;
	GetClientRect(hWnd, (LPRECT)&aWinRect);
	gViewer = Q3WinViewerNew (hWnd, &aWinRect, 
		(unsigned long) kQ3ViewerDefault);
	return gViewer;
}
The third parameter to the call to Q3WinViewerNew is a set of viewer flags that specify information about the appearance and behavior of the new viewer object. Typically the viewer flag parameter is set to the value kQ3ViewerDefault, indicating that the default values of the viewer flags are to be used. See “Viewer Flags,” for a complete description of the available viewer flags.
Alternatively, a QuickDraw 3D Viewer can be created using the Win32 window creation APIs (CreateWindow, CreateWindowEx). The Q3Viewer.DLL registers a window class for the 3D Viewer when the DLL is loaded. This window class is identified by the class name defined by the constant kQ3ViewerClassName. The following example shows how a 3D Viewer window can be created using CreateWindowEx API.
hwndViewer = CreateWindowEx 
(flags & kQ3ViewerDraggingInOff ? 0: WS_EX_ACCEPTFILES , 
	kQ3ViewerClassName,		
	"My 3D Viewer", 
	dwFlags | flags, 
	rect.left, rect.top, rect.right - rect.left, rect.bottom 	- rect.top,
	hWnd, 
	NULL, 
	hInst, 
	NULL);
	41.3.4	Attaching Data to a Viewer
You specify the 3D model to be displayed in a viewer pane’s picture area by calling either the Q3WinViewerUseFile or Q3WinViewerUseData function. Q3WinViewerUseFile takes a reference to an existing viewer object and a file reference number of an open 3DMF metafile, as follows:
myErr = Q3WinViewerUseFile(myViewer, myFsRefNum);
You use the Q3WinViewerUseData function to specify a 3D model whose data is already in memory (either on the Clipboard or elsewhere in RAM). Q3WinViewerUseData takes a reference to an existing viewer object, a pointer to the 3DMF metafile data in RAM, and the number of bytes occupied by that data. Here’s an example of calling Q3WinViewerUseData:
myErr = Q3WinViewerUseData(myViewer, myDataPtr,
 	myDataSize);
IMPORTANT
The data in the buffer whose address and size you pass to Q3WinViewerUseData must be in the QuickDraw 3D Metafile (3DMF) format. 
Once you attach the metafile data to a visible viewer object, the user is able to see the 3D model in the viewer pane. If, however, the viewer pane was invisible when it was created, you need to call the Q3WinViewerDraw function to make it visible.
The 3D Viewer treats the model data as a single group. You can get a reference to the model data currently displayed in the viewer’s picture area by calling the Q3WinViewerGetGroup function. You can change that model data by calling the Q3WinViewerUseGroup function.
You can also retrieve the view object associated with a viewer object by calling the Q3WinViewerGetView function. You can then modify some of the view settings, such as the lights or the camera. If you wish, you can also restore the view settings to their original values by calling the Q3WinViewerRestoreView function.
An application can also set the viewer to display one of several predefined points of view by calling Q3WinViewerSetCameraView and Q3WinViewerSetCameraNumber.
	41.5	3D Viewer Reference
This section describes the constants and routines that you can use to create and manage instances of the 3D Viewer.
	41.5.1	Constants
This section describes the constants you might need to use when creating and managing a viewer object.
	41.5.1.2	Viewer Flags 
When you create a new viewer object (by calling Q3WinViewerNew or CreateWindow), you need to specify a set of viewer flags that control various aspects of the new viewer object.
enum {
	kQ3ViewerShowBadge 		= 1<<0,
	kQ3ViewerActive				= 1<<1,
	kQ3ViewerControllerVisible	= 1<<2,
	kQ3ViewerButtonCamera		= 1<<3,
	kQ3ViewerButtonTruck		= 1<<4,
	kQ3ViewerButtonOrbit		= 1<<5,
	kQ3ViewerButtonZoom		= 1<<6,
	kQ3ViewerButtonDolly		= 1<<7,
	kQ3ViewerButtonReset		= 1<<8,
	kQ3ViewerButtonNone		= 1<<9,
	kQ3ViewerOutputTextMode	= 1<<10,
	kQ3ViewerDraggingInOff	= 1<<11,
	kQ3ViewerDefault			= 1<<15
};
Constant descriptions
kQ3ViewerShowBadge
If this flag is set, a badge is displayed in the viewer pane whenever the controller strip is not visible. See "Badges" for details on when the badge appears and disappears. If this flag is clear, no badge is displayed. This flag is off by default.
kQ3ViewerActive
If this flag is set, the viewer object is active. When cleared the viewer object is in-active and the control strip, if displayed, is dimmed. This flag is on by default.
kQ3ViewerControllerVisible
If this flag is set, the controller strip is visible. If this flag is clear, the controller strip is not visible. When the kQ3ViewerShowBadge flag is set, the controller strip should be made not visible by clearing this flag. This flag is on by default.
kQ3ViewerDraggingInOff Disables dropping files into the 3D Viewer. See "Drag and Drop" section for a discussion of drag and drop and the viewer. This flag is off by default.
kQ3ViewerButtonCamera
If this flag is set, the camera angle popup in the controller strip is displayed.  This flag is on by default.
kQ3ViewerButtonTruck
When used with Q3WinViewerSetFlags this flag is used to set the distance button in the controller strip to be displayed. When used with Q3WinViewerSetCurrentButton. it sets the viewer to distance mode and selects the distance button. This flag is on by default.
kQ3ViewerButtonOrbit
When used with Q3WinViewerSetFlags this flag is used to set the rotate button in the controller strip to be displayed. When used with Q3WinViewerSetCurrentButton. it sets the viewer to rotate mode and selects the rotate button. This flag is on by default.
kQ3ViewerButtonZoom
When used with Q3WinViewerSetFlags this flag is used to set the zoom button in the controller strip to be displayed. When used with Q3WinViewerSetCurrentButton. it sets the viewer to zoom mode and selects the zoom button. This flag is off by default.
Note: the zoom button is not displayed by default.
kQ3ViewerButtonDolly
When used with Q3WinViewerSetFlags this flag is used to set the move button in the controller strip to be displayed. When used with Q3WinViewerSetCurrentButton. it sets the viewer to move mode and selects the move button. This flag is on by default.
kQ3ViewerButtonReset 
When used with Q3WinViewerSetFlags this flag is used to set the reset button in the controller strip to be displayed. This flag is on by default.
Note: the reset button is a push-button and does not change the mode of the viewer when pressed.
kQ3ViewerOutputTextMode 
When set kQ3ViewerOutputTextMode this flag causes Q3WinViewerWriteFile to output 3DMF in text-mode. This flag is off by default.
kQ3ViewerButtonNone 
When used with Q3WinViewerSetCurrentButton this flag sets the viewer to a mode where most interaction is ignored. When in this mode the viewer only responds to file drops and badge interaction. This flag is off by default.
kQ3ViewerDefault 
The default configuration for a viewer object. 
	41.5.1.3	Viewer State Flags 
The Q3WinViewerGetState function returns a long integer that encodes information about the current state of a viewer object. Bits of the returned long integer are addressed using these viewer state flags:
enum {
	kQ3ViewerEmpty    = 0,
	kQ3ViewerHasModel = 1<<0,
	kQ3ViewerHasUndo  = 1<<1
};
Constant descriptions
kQ3ViewerEmpty If this flag is set, there is no image currently displayed by the specified viewer object.
kQ3ViewerHasModel If this flag is set, there is an image currently displayed by the specified viewer object.
kQ3ViewerHasUndo  If this flag is set, the viewer camera has been modified and thus can be undone. An application might use this information when deciding whether to enable the undo menu item. Also see the function Q3WinViewerGetUndoString.
	41.5.1.4	Camera View Command Constants 
The Q3WinViewerSetCameraView function takes one of the following camera view commands. These commands set the viewer to a predefined camera view.
typedef enum TQ3ViewerCameraView {
	kQ3ViewerCameraRestore,
	kQ3ViewerCameraFit,
	kQ3ViewerCameraFront,
	kQ3ViewerCameraBack,
	kQ3ViewerCameraLeft,
	kQ3ViewerCameraRight,
	kQ3ViewerCameraTop,
	kQ3ViewerCameraBottom
} TQ3ViewerCameraView;
Constant descriptions
kQ3ViewerCameraRestore  
This command resets the viewer’s camera view to its original position. The result of calling Q3WinViewerSetCameraViwer with the kQ3ViewerCameraRestore command  is the same as calling the function  Q3WinViewerRestoreView. Both Q3WinViewerRestoreView and the kQ3ViewerCameraRestore command perform the same function as the viewer’s reset button
kQ3ViewerCameraFit 
This command repositions the camera such that the 3D model data fits the viewer content pane.
kQ3ViewerCameraFront,  
	kQ3ViewerCameraBack,  
	kQ3ViewerCameraLeft,  
	kQ3ViewerCameraRight,  
	kQ3ViewerCameraTop,  
	kQ3ViewerCameraBottom   
These commands position the viewer camera to predefined positions based on the front and top attributes in the data model if they are present. If the front and top attributes are not present in the data the camera positions are calculated from the model’s coordinate space.
	41.5.2	3D Viewer Routines
This section describes the routines that you can use to create and manage the 3D Viewer. You can use these routines to
•	create a new viewer object
•	dispose of a viewer object
•	attach a file or block of data to a viewer object
•	handle editing operations associated with a viewer object
Note You don’t need to use all of these routines in order to use the 3D Viewer. For a description of which routines are required in a typical application, see “Using the 3D Viewer on Win32.” 
	41.5.2.1	Creating and Destroying Viewers
This section describes the routines you can use to create and destroy viewer objects. See “Creating a Viewer” for complete source code examples that illustrate how to use these routines.
41.5.2.1.1	Q3WinViewerNew
You can use the Q3WinViewerNew function to create a new viewer object.
TQ3WinViewerObject Q3WinViewerNew (
	HWND window,
	RECT *rect,
	unsigned long flags);
port  The parent window of the viewer you are about to instantiate. Passing NULL will cause a popup viewer window with no parent to be created.
rect The desired viewer pane for the new viewer object. This Win32 RECT rectangle is specified in client coordinates, where the origin (0, 0) is the upper-left corner of the window and values increase to the right and down the window.
flags A set of viewer flags.  Any of the Windows window style flags may be included as well.
DESCRIPTION
The Q3WinViewerNew function returns, as its function result, a reference to a new viewer object that is to be drawn in the window specified by the windows parameter, in the location specified by the rect parameter. The flags parameter specifies the desired set of viewer flags. See “Viewer Flags” or information on the flags you can specify when calling Q3WinViewerNew.
The Q3WinViewerNew function calls the QuickDraw 3D function Q3Initialize if your application has not already called it. (See also CreateWindow and CreateWindowEx).

	41.5.2.1.2	Q3WinViewerDispose
You can use the Q3WinViewerDispose function to dispose of a viewer object.
TQ3Status Q3WinViewerDispose (TQ3WinViewerObject theViewer);
theViewer A viewer object.

DESCRIPTION
The Q3WinViewerDispose function disposes of the viewer object specified by the theViewer parameter.  (see also DisposeWindow).

	41.5.2.2	Attaching Data to a Viewer
	41.5.2.2.1	Q3WinViewerUseFile
You can use the Q3WinViewerUseFile function to set the file containing the 3D model to be displayed in a viewer object.
TQ3Status Q3WinViewerUseFile (
	TQ3WinViewerObject theViewer, 
	Handle fileh);
theViewer A viewer object.
fileh The Windows file handle of an open file.
DESCRIPTION
The Q3WinViewerUseFile function sets the 3D data file to be displayed in the viewer object specified by the theViewer parameter to the open file having the file handle specified by the fileh parameter.
	41.5.2.2.2	Q3WinViewerUseData
You can use the Q3WinViewerUseData function to set the memory-based data displayed in a viewer object.
TQ3Status Q3WinViewerUseData (
	TQ3WinViewerObject theViewer,
	void *data,
	long size);
theViewer A viewer object.
data A pointer to the beginning of a block of data in memory.
size The size, in bytes, of the specified block of data.
DESCRIPTION
The Q3WinViewerUseData function sets the 3D data to be displayed in the viewer object specified by the theViewer parameter to the data block beginning at the address specified by the data parameter and having the size specified by the size parameter.

	41.5.2.3	Drawing the Viewer and Rendering the Viewer Data
	41.5.2.3.1	Q3WinViewerDraw
You can use the Q3WinViewerDraw function to draw a viewer object.
TQ3Status Q3WinViewerDraw (
	TQ3WinViewerObject theViewer);
theViewer A viewer object.
DESCRIPTION
The Q3WinViewerDraw function draws the viewer object specified by the theViewer parameter. You need to call this function any time you wish to force an update of the viewer window.  You can also use Win32 specific APIs (UpdateWindow, InvalidateRect, etc.) to force an update.
	41.5.2.3.2	Q3WinViewerDrawContent
You can use the Q3WinViewerDrawContent function to redraw (or render) only the 3D content displayed in a viewer object.
TQ3Status Q3WinViewerDrawContent(
	TQ3WinViewerObject theViewer);
theViewer A viewer object.
DESCRIPTION
The Q3WinViewerDrawContent function forces the viewer to re-render the 3D data displayed in the viewer object specified by the theViewer parameter. You would only call this function if your application has directly modified the viewer’s 3D model data using the QuickDraw 3D API.  An application would use this call instead of Q3WinViewerDraw in order to avoid the flicker assocatated with redrawing user interface elements. 
	41.5.2.3.3	Q3WinViewerDrawControlStrip
You can use the Q3WinViewerDrawControlStrip function to redraw  the user interface elements of the viewer.
TQ3Status Q3WinViewerDrawControlStrip(
	TQ3WinViewerObject theViewer);
theViewer A viewer object.
DESCRIPTION
The Q3WinViewerDrawControlStrip function forces the viewer to redraw the user interface elements of the viewer object specified by the theViewer parameter.  The user interface elements are the control strip and its buttons and the badge. You would typically use this call instead of Q3WinViewerDraw if you want to update the control strip but specifically do not want to re-render the 3D data displayed by the viewer.   You can also cause the same effect by getting the control strips windows (Q3WinViewerGetControlStrip) and using Win32 calls to force an update (UpdateWindow).

	41.5.2.4	Accessing Viewer Information and State
The 3D Viewer provides routines that you can use to get and set information about a viewer object.
	41.5.2.4.1	Q3WinViewerGetView
You can use the Q3WinViewerGetView function to get the view object associated with a viewer object.
TQ3ViewObject Q3WinViewerGetView (TQ3WinViewerObject
	theViewer);
theViewer A viewer object.
DESCRIPTION
The Q3WinViewerGetView function returns, as its function result, the view object currently associated with the viewer specified by the theViewer parameter.
	41.5.2.4.2	Q3WinViewerRestoreView
You can use the Q3WinViewerRestoreView function to restore the camera associated with a viewer object.
OSErr Q3WinViewerRestoreView (TQ3WinViewerObject 
	theViewer);
theViewer A viewer object.
DESCRIPTION
The Q3WinViewerRestoreView function restores the camera settings of the viewer specified by the theViewer parameter to the original camera specified in the associated view hints object. If there is no view hints object associated with the specified viewer, Q3WinViewerRestoreView creates a new default camera. Q3WinViewerRestoreView performs the same function as the reset button.
	41.5.2.4.3	Q3WinViewerSetCameraView
You can use the Q3WinViewerSetCameraView function to restore the camera associated with a viewer object.
TQ3Status Q3WinViewerSetCameraView(
		TQ3WinViewerObject 		theViewer, 
		TQ3WinViewerCameraView viewType);
theViewer A viewer object.
viewType One of the camera view command.
DESCRIPTION
The Q3WinViewerSetCameraView function performs a command defined by the viewType parameter which can modify the camera settings of the viewer specified by the theViewer parameter. These commands include setting the camera to a pre-defined cannonical camera position: front, back, top, bottom, left and right; fitting the camera to the data’s bounding sphere or restoring the camera to the original positon. The camera view commands which can be used with Q3WinViewerSetCameraView are 
	kQ3ViewerCameraRestore,
	kQ3ViewerCameraFit,
	kQ3ViewerCameraFront,
	kQ3ViewerCameraBack,
	kQ3ViewerCameraLeft,
	kQ3ViewerCameraRight,
	kQ3ViewerCameraTop,
	and kQ3ViewerCameraBottom.
See “Camera View Command Constants” for descriptions.
	41.5.2.4.4	Q3WinViewerGetCameraCount
You can use the Q3WinViewerGetCameraCount to query the number of camera objects associated with the view hints of the current 3D model data used by the viewer. 
TQ3Status Q3WinViewerGetCameraCount(
		TQ3ViewerObject 	theViewer, 
		unsigned long 	*cnt);
theViewer A viewer object.
cnt On exit, the number of camera objects in the 3D model data. 
DESCRIPTION
The Q3WinViewerGetCameraCount function returns through the cnt parameter the number of camera objects specified in the 3D model data associated with the viewer specified by the theViewer parameter. If there is no view hints object associated with the specified viewer, Q3WinViewerGetCameraCount will return a count of 0. 
Note: only cameras of the type kQ3CameraViewAngleAspect are counted by this routine.
	41.5.2.4.5	Q3WinViewerSetCameraNumber
You can use the Q3WinViewerSetCameraNumber function sets the viewer to use the nth camera associated with a viewer object.
TQ3Status Q3WinViewerSetCameraNumber(
		TQ3ViewerObject 	theViewer, 
		unsigned long 	cameraNo);
theViewer A viewer object.
cameraNo A camera index (one-based). i.e. The first camera can be set by passing 1.
DESCRIPTION
The Q3WinViewerSetCameraNumber function sets the camera settings of the viewer specified by the theViewer parameter to the nth camera specified in the associated view hints object. The cameraNo parameter specifies the nth camera and should not be larger than the number of available view aspect angle cameras returned by Q3WinViewerGetCameraCount.  This function performs the same result as selecting one of the view hints defined cameras in the camera angle popup.

	41.5.2.4.6	Q3WinViewerGetFlags
You can use the Q3WinViewerGetFlags function to get the current viewer flags for a viewer object.
unsigned long Q3WinViewerGetFlags(TQ3ViewerObject
	theViewer);
theViewer A viewer object.
DESCRIPTION
The Q3WinViewerGetFlags function returns, as its function result, the current set of viewer flags for the viewer specified by the theViewer parameter.
	41.5.2.4.7	Q3WinViewerSetFlags
You can use the Q3WinViewerSetFlags function to set the viewer flags for a viewer object.
TQ3Status Q3WinViewerSetFlags (
	TQ3ViewerObject theViewer,
	unsigned long flags);
theViewer A viewer object.
flags A set of viewer flags. See “Viewer Flags” for a description of the constants you can use to set or clear individual viewer flags.
DESCRIPTION
The Q3WinViewerSetFlags function sets the viewer flags associated with the viewer object specified by the theViewer parameter to the values passed in the flags parameter.  All flags aplying to the control strip cause and immediate referesh upon setting.  Other flags may require you to update the viewer window by calling Q3WinViewerDraw or Win32 API UpdateWindow.  (NOTE we should list the ones that need a refresh and the ones that do not)
	41.5.2.4.8	Q3WinViewerGetBounds
You can use the Q3WinViewerGetBounds function to get the rectangle that bounds a viewer’s pane.
TQ3Status Q3WinViewerGetBounds (
	TQ3ViewerObject theViewer,
	RECT *bounds);
theViewer A viewer object.
bounds On exit, the Windows rectangle that bounds the pane currently associated with the specified viewer object.  This rectangle is in client coordinates of the parent window.
DESCRIPTION
The Q3WinViewerGetBounds function returns, through the bounds parameter, the  rectangle that currently bounds the pane associated with the viewer object specified by the bounds parameter.
	41.5.2.4.9	Q3WinViewerSetBounds 
You can use the Q3WinViewerSetBounds function to set the rectangle that bounds a viewer’s pane.
TQ3Status Q3WinViewerSetBounds (
	TQ3ViewerObject theViewer,
	RECT *bounds);
theViewer A viewer object.
bounds The desired viewer pane for the specified viewer object. This Windows rectangle is specified in client coordinates, where the origin (0, 0) is the upper-left corner of the window and values increase to the right and down the window.
DESCRIPTION
The Q3WinViewerSetBounds function sets the bounds of the viewer pane of the viewer object specified by the theViewer parameter to the rectangle specified by the bounds parameter.  Calling this function will force the viewer window to be redrawn.
	41.5.2.4.10	Q3WinViewerGetMinimumDimensions
You can use the Q3WinViewerGetBounds function to get the rectangle that bounds a viewer’s pane.
TQ3Status Q3WinViewerGetMininumDimension(
	TQ3ViewerObject 	theViewer,
	unsigned long 	*width,
	unsigned long 	*height);
theViewer A viewer object.
width On exit, the minimum viewer pane width required to display the entire contents of the control strip.
height On exit, the minimum viewer pane height required to display the control strip.
DESCRIPTION
The Q3WinViewerGetMininumDimension function returns, through the width and height parameters, the  minimum dimensions required to display the viewer control strip of the viewer object specified by the parameter theViewer. An application which implements a resizable viewer pane should make sure the viewer doesn’t get sized smaller than these minimum dimentions returned by this function. If a viewer pane displaying a control strip is sized smaller than these dimension some of the buttons in the control strip will be clipped.  Ths function will not operate unless theViewer currently is shown with a control strip.
	41.5.2.4.11	Q3WinViewerGetWindow
You can use the Q3WinViewerGetWindow function to get the HWND associated with the viewer.
HWND Q3WinViewerGetWindow (TQ3ViewerObject 	
	theViewer);
theViewer A viewer object.
DESCRIPTION
The Q3WinViewerGetwindow function returns, as its function result, the HWND currently associated with the viewer object specified by the theViewer parameter.
	41.5.2.4.12	Q3WinViewerSetWindow
You can use the Q3WinViewerSetWindow function to set the parent HWND of a viewer window.
TQ3Status Q3WinViewerSetWindow (TQ3ViewerObject theViewer, 	
	HWND window);
theViewer A viewer object.
window A HWND that will be the new parent window of the viewer control window. You may also pass in NULL for the HWND, which will allow you to create an empty viewer that can be associated with an HWND later.
DESCRIPTION
The Q3WinViewerSetWindow function sets the Windows parent window associated with the viewer object specified by the theViewer parameter to the HWND specified by the window parameter. 
	41.5.2.4.13	Q3WinViewerGetGroup
You can use the Q3WinViewerGetGroup function to get the group of objects currently associated with a viewer.
TQ3GroupObject Q3WinViewerGetGroup (TQ3ViewerObject 
	theViewer);
theViewer A viewer object.
DESCRIPTION
The Q3WinViewerGetGroup function returns, as its function result, a reference to the group containing the objects currently associated with the viewer specified by the theViewer parameter. The reference count of that group is incremented. You should therefore dispose of the group when you have finished using it.
	41.5.2.4.14	Q3WinViewerUseGroup
You can use the Q3WinViewerUseGroup function to set the group of objects associated with a viewer.
TQ3Status Q3WinViewerUseGroup (
	TQ3ViewerObject theViewer,
	TQ3GroupObject group);
	theViewer A viewer object.
group A group.
DESCRIPTION
The Q3WinViewerUseGroup function sets the group of objects associated with the viewer specified by the theViewer parameter to the group specified by the group parameter.
	41.5.2.4.15	Q3WinViewerGetState
You can use the Q3WinViewerGetState function to get the current state of a viewer object.
unsigned long Q3WinViewerGetState (TQ3ViewerObject
 	theViewer);
theViewer A viewer object.
DESCRIPTION
The Q3WinViewerGetState function returns a long integer that encodes information about the current state of the viewer object specified by the theViewer parameter. Bits of the returned long integer are addressed using these constants, which define the viewer state flags:
enum {
	kQ3ViewerEmpty    = 0,
	kQ3ViewerHasModel = 1<<0,
	kQ3ViewerHasUndo  = 1<<1
};
If Q3WinViewerGetState returns the value kQ3ViewerEmpty, there is no image currently displayed by the specified viewer object. If Q3WinViewerGetState returns the value kQ3ViewerHasModel, there is an image currently displayed by the specified viewer object. If Q3WinViewerGetState returns the value kQ3ViewerHasUndo, the user has modified the camera state through the interactive controls. You can use this information to determine whether Edit menu commands such as Undo, Cut, Clear, and Copy should be enabled or disabled. Also see Q3WinViewerGetUndoString.